static void
gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup)
+ GtkCssLookup *lookup,
+ GtkCssChange *change)
{
GtkStyleProperties *props;
GtkStylePropertiesPrivate *priv;
_gtk_css_lookup_set (lookup, id, NULL, value);
}
-}
-static GtkCssChange
-gtk_style_properties_provider_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- return GTK_CSS_CHANGE_STATE;
+ if (change)
+ *change = GTK_CSS_CHANGE_STATE;
}
static void
{
iface->get_color = gtk_style_properties_provider_get_color;
iface->lookup = gtk_style_properties_provider_lookup;
- iface->get_change = gtk_style_properties_provider_get_change;
}
/* GtkStyleProperties methods */
static void
gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup)
+ GtkCssLookup *lookup,
+ GtkCssChange *change)
{
GtkCssProvider *css_provider;
GtkCssProviderPrivate *priv;
}
g_ptr_array_free (tree_rules, TRUE);
-}
-
-static GtkCssChange
-gtk_css_style_provider_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- GtkCssProvider *css_provider;
- GtkCssProviderPrivate *priv;
- GtkCssChange change;
- css_provider = GTK_CSS_PROVIDER (provider);
- priv = css_provider->priv;
-
- change = _gtk_css_selector_tree_get_change_all (priv->tree, matcher);
+ if (change)
+ {
+ GtkCssMatcher change_matcher;
- verify_tree_get_change_results (css_provider, matcher, change);
+ _gtk_css_matcher_superset_init (&change_matcher, matcher, GTK_CSS_CHANGE_NAME | GTK_CSS_CHANGE_CLASS);
- return change;
+ *change = _gtk_css_selector_tree_get_change_all (priv->tree, &change_matcher);
+ verify_tree_get_change_results (css_provider, &change_matcher, *change);
+ }
}
static void
iface->get_color = gtk_css_style_provider_get_color;
iface->get_keyframes = gtk_css_style_provider_get_keyframes;
iface->lookup = gtk_css_style_provider_lookup;
- iface->get_change = gtk_css_style_provider_get_change;
}
static void
static void
gtk_modifier_style_provider_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup)
+ GtkCssLookup *lookup,
+ GtkCssChange *change)
{
GtkModifierStyle *style = GTK_MODIFIER_STYLE (provider);
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (style->priv->style),
matcher,
- lookup);
-}
-
-static GtkCssChange
-gtk_modifier_style_provider_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- GtkModifierStyle *style = GTK_MODIFIER_STYLE (provider);
-
- return _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (style->priv->style),
- matcher);
+ lookup,
+ change);
}
static void
{
iface->get_color = gtk_modifier_style_provider_get_color;
iface->lookup = gtk_modifier_style_provider_lookup;
- iface->get_change = gtk_modifier_style_provider_get_change;
}
static void
{
}
-static GtkCssChange
-gtk_settings_style_provider_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- return 0;
-}
-
-
static GtkSettings *
gtk_settings_style_provider_get_settings (GtkStyleProviderPrivate *provider)
{
gtk_settings_provider_private_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_settings = gtk_settings_style_provider_get_settings;
- iface->get_change = gtk_settings_style_provider_get_change;
}
static void
static void
gtk_style_cascade_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup)
+ GtkCssLookup *lookup,
+ GtkCssChange *change)
{
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
GtkStyleCascadeIter iter;
GtkStyleProvider *item;
+ GtkCssChange iter_change;
for (item = gtk_style_cascade_iter_init (cascade, &iter);
item;
{
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (item),
matcher,
- lookup);
+ lookup,
+ change ? &iter_change : NULL);
+ if (change)
+ *change |= iter_change;
}
else
{
}
}
-static GtkCssChange
-gtk_style_cascade_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
- GtkStyleCascadeIter iter;
- GtkStyleProvider *item;
- GtkCssChange change = 0;
-
- for (item = gtk_style_cascade_iter_init (cascade, &iter);
- item;
- item = gtk_style_cascade_iter_next (cascade, &iter))
- {
- if (GTK_IS_STYLE_PROVIDER_PRIVATE (item))
- {
- change |= _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (item),
- matcher);
- }
- else
- {
- g_return_val_if_reached (GTK_CSS_CHANGE_ANY);
- }
- }
-
- return change;
-}
-
static void
gtk_style_cascade_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_settings = gtk_style_cascade_get_settings;
iface->get_keyframes = gtk_style_cascade_get_keyframes;
iface->lookup = gtk_style_cascade_lookup;
- iface->get_change = gtk_style_cascade_get_change;
}
G_DEFINE_TYPE_EXTENDED (GtkStyleCascade, _gtk_style_cascade, G_TYPE_OBJECT, 0,
build_properties (GtkStyleContext *context,
GtkCssComputedValues *values,
const GtkCssNodeDeclaration *decl,
- const GtkBitmask *relevant_changes)
+ const GtkBitmask *relevant_changes,
+ GtkCssChange *out_change)
{
GtkStyleContextPrivate *priv;
GtkCssMatcher matcher;
if (_gtk_css_matcher_init (&matcher, path))
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
&matcher,
- lookup);
+ lookup,
+ out_change);
_gtk_css_lookup_resolve (lookup,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
style_info_set_values (info, values);
if (gtk_style_context_is_saved (context))
- g_hash_table_insert (priv->style_values,
- gtk_css_node_declaration_ref (info->decl),
- g_object_ref (values));
-
- build_properties (context, values, info->decl, NULL);
+ {
+ g_hash_table_insert (priv->style_values,
+ gtk_css_node_declaration_ref (info->decl),
+ g_object_ref (values));
+
+ build_properties (context, values, info->decl, NULL, NULL);
+ }
+ else
+ {
+ build_properties (context, values, info->decl, NULL, &priv->relevant_changes);
+ }
g_object_unref (values);
decl = gtk_css_node_declaration_ref (context->priv->info->decl);
gtk_css_node_declaration_set_state (&decl, state);
values = _gtk_css_computed_values_new ();
- build_properties (context, values, decl, NULL);
+ build_properties (context, values, decl, NULL, NULL);
gtk_css_node_declaration_unref (decl);
return values;
changes = _gtk_css_computed_values_compute_dependencies (values, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
- build_properties (context, values, decl, changes);
+ build_properties (context, values, decl, changes, NULL);
_gtk_bitmask_free (changes);
}
/* Try to avoid invalidating if we can */
if (change & GTK_STYLE_CONTEXT_RADICAL_CHANGE)
- {
- priv->relevant_changes = GTK_CSS_CHANGE_ANY;
- }
- else
- {
- if (priv->relevant_changes == GTK_CSS_CHANGE_ANY)
- {
- GtkWidgetPath *path;
- GtkCssMatcher matcher, superset;
-
- path = create_query_path (context, priv->info->decl);
- if (_gtk_css_matcher_init (&matcher, path))
- {
- _gtk_css_matcher_superset_init (&superset, &matcher, GTK_STYLE_CONTEXT_RADICAL_CHANGE & ~GTK_CSS_CHANGE_SOURCE);
- priv->relevant_changes = _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
- &superset);
- }
- else
- priv->relevant_changes = 0;
-
- priv->relevant_changes &= ~GTK_STYLE_CONTEXT_RADICAL_CHANGE;
-
- gtk_widget_path_unref (path);
- }
- }
+ return TRUE;
if (priv->relevant_changes & change)
return TRUE;
{
changes = _gtk_css_computed_values_compute_dependencies (current, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
- build_properties (context, current, info->decl, changes);
+ build_properties (context, current, info->decl, changes, NULL);
gtk_style_context_update_cache (context, parent_changes);
}
void
_gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup)
+ GtkCssLookup *lookup,
+ GtkCssChange *out_change)
{
GtkStyleProviderPrivateInterface *iface;
g_return_if_fail (matcher != NULL);
g_return_if_fail (lookup != NULL);
+ if (out_change)
+ *out_change = 0;
+
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
if (!iface->lookup)
return;
- iface->lookup (provider, matcher, lookup);
-}
-
-GtkCssChange
-_gtk_style_provider_private_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher)
-{
- GtkStyleProviderPrivateInterface *iface;
-
- g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), GTK_CSS_CHANGE_ANY);
- g_return_val_if_fail (matcher != NULL, GTK_CSS_CHANGE_ANY);
-
- iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
-
- if (!iface->get_change)
- return GTK_CSS_CHANGE_ANY;
-
- return iface->get_change (provider, matcher);
+ iface->lookup (provider, matcher, lookup, out_change);
}
void
const char *name);
void (* lookup) (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup);
- GtkCssChange (* get_change) (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher);
+ GtkCssLookup *lookup,
+ GtkCssChange *out_change);
/* signal */
void (* changed) (GtkStyleProviderPrivate *provider);
const char *name);
void _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
- GtkCssLookup *lookup);
-GtkCssChange _gtk_style_provider_private_get_change (GtkStyleProviderPrivate *provider,
- const GtkCssMatcher *matcher);
+ GtkCssLookup *lookup,
+ GtkCssChange *out_change);
void _gtk_style_provider_private_changed (GtkStyleProviderPrivate *provider);